package xiaodong.train.bean;

import java.io.Serializable;

import xiaodong.train.Constants;

/**
 * 用户信息
 */
public class UserInfo implements Serializable {
	/** 字段注释 */
	private static final long serialVersionUID = 1L;

	// 乘车人信息
	private String ID;
	private String name;
	private String phone = "";

	private String seatType = "O"; // 座位类型
	private String tickType = "1"; // 车票类型
	private String cardType = "1"; // 证件类型
	private String seatPos = "0"; // 硬卧铺位
	private String idMode = "Y";

	/**
	 * @return Returns the iD.
	 */
	public String getID() {
		return ID;
	}

	/**
	 * @param iD
	 *            The iD to set.
	 */
	public void setID(String iD) {
		ID = iD;
	}

	/**
	 * @return Returns the name.
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name
	 *            The name to set.
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return Returns the phone.
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * @param phone
	 *            The phone to set.
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * @return Returns the seatType.
	 */
	public String getSeatType() {
		return seatType;
	}

	/**
	 * @param seatType
	 *            The seatType to set.
	 */
	public void setSeatType(String seatType) {
		this.seatType = seatType;
	}

	/**
	 * @return Returns the tickType.
	 */
	public String getTicketType() {
		return tickType;
	}

	/**
	 * @param tickType
	 *            The tickType to set.
	 */
	public void setTicketType(String tickType) {
		this.tickType = tickType;
	}

	/**
	 * @return Returns the cardType.
	 */
	public String getCardType() {
		return cardType;
	}

	/**
	 * @param cardType
	 *            The cardType to set.
	 */
	public void setCardType(String cardType) {
		this.cardType = cardType;
	}

	public String getSeatPos() {
		return Constants.HARD_SLEEPER.equals(this.seatType) ? seatPos : "0";
	}

	public void setSeatPos(String seatPos) {
		this.seatPos = seatPos;
	}

	/**
	 * @return Returns the idMode.
	 */
	public String getIdMode() {
		return idMode;
	}

	public String getText() {
		StringBuilder builder = new StringBuilder();
		builder.append(seatType).append(",").append(getSeatPos()).append(",")
				.append(tickType).append(",").append(getSimpleText())
				.append(",,").append(idMode);
		return builder.toString();
	}

	public String getSimpleText() {
		StringBuilder builder = new StringBuilder();
		builder.append(name).append(",").append(cardType).append(",")
				.append(ID); // .append(",").append(phone)
		return builder.toString();
	}

	/**
	 * override 方法
	 * 
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		builder.append("UserInfo [ID=").append(ID).append(", name=")
				.append(name)
				.append(", phone=")
				.append(phone)
				// .append(", rangDate=").append(", startDate=")
				.append(", seatPos=").append(seatPos).append(", seatType=")
				.append(seatType).append(", tickType=").append(tickType)
				.append(", cardType=").append(cardType).append(", idMode=")
				.append(idMode).append("]");
		return builder.toString();
	}
}
